﻿#region

using System.Collections.Generic;
using System.ComponentModel;
using HouseHoldBudget.Core.Entities.Expenses;
using HouseHoldBudget.Core.Entities.Incomes;

#endregion

namespace HouseHoldBudget.Core.Entities.User
{
    public class BudgetUser : BaseEntity
    {
        #region Fields

        private ICollection<BudgetUserRole> _userRoles;
        private ICollection<FixedIncome> _fixedIncomes;
        private ICollection<OccasionalIncome> _occasionaldIncomes;
        private ICollection<Expense> _expenses;

        #endregion

        #region Instance Properties

        /// <summary>
        ///   Gets or sets a value indicating whether the user is active.
        /// </summary>
        /// <value> <c>true</c> if this instance is active; otherwise, <c>false</c> . </value>
        public virtual bool IsActive { get; set; }

        /// <summary>
        ///   Gets or sets the user email.
        /// </summary>
        /// <value> The user email. </value>
        public virtual string UserEmail { get; set; }

        /// <summary>
        ///   Gets or sets the last name of the user.
        /// </summary>
        /// <value> The last name of the user. </value>
        public virtual string UserLastName { get; set; }

        /// <summary>
        ///   Gets or sets the user login.
        /// </summary>
        /// <value> The user login. </value>
        public virtual string UserLogin { get; set; }

        /// <summary>
        ///   Gets or sets the name of the user.
        /// </summary>
        /// <value> The name of the user. </value>
        public virtual string UserFirstName { get; set; }

        /// <summary>
        ///   Gets or sets the user password.
        /// </summary>
        /// <value> The user password. </value>
        public virtual string UserPassword { get; set; }

        /// <summary>
        ///   Gets or sets the user roles.
        /// </summary>
        /// <value> The user roles. </value>
        public virtual ICollection<BudgetUserRole> BudgetUserRoles
        {
            get
            {
                return _userRoles ?? (_userRoles = new List<BudgetUserRole>());
            }
            protected set
            {
                _userRoles = value;
            }
        }

        /// <summary>
        /// Gets or sets the fixed incomes.
        /// </summary>
        /// <value>
        /// The fixed incomes.
        /// </value>
        public virtual ICollection<FixedIncome> FixedIncomes
        {
            get
            {
                return _fixedIncomes ?? (_fixedIncomes = new List<FixedIncome>());
            }
            protected set
            {
                _fixedIncomes = value;
            }
        }

        /// <summary>
        /// Gets or sets the occasional incomes.
        /// </summary>
        /// <value>
        /// The occasional incomes.
        /// </value>
        public virtual ICollection<OccasionalIncome> OccasionalIncomes
        {
            get
            {
                return _occasionaldIncomes ?? (_occasionaldIncomes = new List<OccasionalIncome>());
            }
            protected set
            {
                _occasionaldIncomes = value;
            }
        }

        /// <summary>
        /// Gets or sets the expenses.
        /// </summary>
        /// <value>
        /// The expenses.
        /// </value>
        public virtual ICollection<Expense> Expenses
        {
            get
            {
                return _expenses ?? (_expenses = new List<Expense>());
            }
            protected set
            {
                _expenses = value;
            }
        }

        #endregion

        #region Instance Methods

        /// <summary>
        ///   Returns a <see cref="System.String" /> that represents this instance.
        /// </summary>
        /// <returns> A <see cref="System.String" /> that represents this instance. </returns>
        public override string ToString()
        {
            return string.Format("{0} {1}", UserFirstName, UserLastName);
        }

        #endregion
    }
}